זו שאלה ממבחן בית (היו 2 שאלות, אחת קלה והשנייה בינונית) לאחר התכנות היה חלק של שאלון אישיות
שאלות מתוך הראיון
יש מערך של מיקומי שרתים ומערך של מיקומים של מרכזי נתונים. כל מרכז יכול להעביר מידע לכל שרת. צריך לחשב מהו סכום המרחקים המינימלי בין השרתים למרכזים., כאשר מרחק הוא ההפרש בערך מוחלט בין המיקומים.
OA - קיבלתי מייל להשלמת מבחן עם 2 שאלות תכנות, 70 דק'.
שאלות מתוך הראיון
An AWS client has brought servers and databases from data centers in different parts of the world for their
application. For simplicity, let's assume all the servers and data centers are located on a 1-dimensional line.
You have been given the task of optimizing the network connection. Each data center must be connected
to a server. The positions of n data centers and n servers are given in the form of arrays. Any particular
data center, centerli, can deliver to any particular server destination, destination [j/. The lag is defined
distance between a data center at location x and a server destination at location yis |x-y|, i.e., the
absolute difference between x and y. Determine the minimum lag to establish the entire network.
תשובות
הוסף תשובה
|
לצפיה בתשובות
ינואר 2025
ניתן למיין את 2 המערכים ( n*log(n) + k*log(k) )
כעת ניתן לחשב הפרש בין כל אינדקס בין 2 המערכים והסכום זה התוצאה שנחזיר
(בגלל המיון בהכרח זה המרחים הקצרים)